package net.huashitong.common.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.common.dao.SysAnnouncementDao;
import net.huashitong.common.entity.SysAnnouncement;
import net.huashitong.common.filter.SysAnnouncementFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysAnnouncementService extends StringPKService<SysAnnouncement> {
    @Autowired
    private SysAnnouncementDao sysAnnouncementDao;
    @Autowired
    private SysTableService tableService;
    @Override
    protected BaseDao<SysAnnouncement, String> getDao() {
        return sysAnnouncementDao;
    }

    @Override
    protected void beforeSave(SysAnnouncement obj) {
        obj.setSysId(tableService.updateMaxSysId("t_common_announce", null));
    }

    public List<SysAnnouncement> queryByFilter(SysAnnouncementFilter filter) {
        return sysAnnouncementDao.queryByFilter(filter);
    }
}
